<template>
	<scroll ref="mescrollRef" @init="mescrollInit" :down="downOption"  @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
		<stop isBack>
			<view slot="content">我的报修</view>
		</stop>
		<view class="bcf padlr3 padtb2 bdtso">
			<search class="fs8 tac" placeholder="故障 \ 单号 \ 设备名称 \ 编码 \ 型号"  v-model="search" @search="doSearch()"></search>
		</view>
		<view class="flrc bcf pad3 bdtso bdbso fs8">
			<view class="flex1"><scondition @input="reload()" model="MachineBreakStatus" v-model="where.eq.status" label="订单状态"></scondition></view>
			<view class="flex1"><scondition @input="reload()" model="MachineBreakEmergency" v-model="where.eq.emergency" label="紧急程度"></scondition></view>
			<view class="flex1"><scondition @input="reload()" model="MachineBreakLevel" v-model="where.eq.level" label="故障等级"></scondition></view>
		</view>
		<view class="padlr3">
			<view class="bcf pos-r mart3 round2 shadow ofh" 
			@tap="mySlide(index)" 
			v-for="item,index in data" :key="item.sn">
				<breaks class="mar2" :item="item" :showAngle="false"></breaks>
				<sslide class="bg-gradual-orange w30" ref="mySlideBox" >
					<view class="w100 flex1 flcc pos-r" 
					@tap="goto('/pages/machine/break_order_info?id='+item.id)">
						查看<ripple></ripple>
					</view>
					<view class="w100 flex1 flcc pos-r bdtso" v-show="!item.status.isLocked"
						@tap="goto('/pages/machine/break_order?id='+item.id)">
						修改<ripple></ripple>
					</view>
					<view class="w100 flex1 flcc pos-r bdtso"  v-show="!item.status.isLocked"
						@tap="goto('/pages/machine/break_order_confirm?id='+item.id)">
						确认<ripple></ripple>
					</view>
					<view class="w100 flex1 flcc pos-r bdtso"  v-show="!item.status.isLocked"
						@tap="goto('/pages/machine/break_order_cancel?id='+item.id)">
						取消<ripple></ripple>
					</view>
				</sslide>
			</view>
		</view>
		<loading :loading="myIsLoading"></loading>
	</scroll>
</template>

<script>
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
	import List from '../../assets/js/list.js'
	import breaks from '../../templete/machine/machine_break_list_com.vue'
	export default {
		mixins:[MescrollMixin],
		components:{breaks},
		data() {
			let list = new List()
			return {
				list,
				where:{
					eq:{
						status:'',
						emergency:'',
						level:'',
					}
				},
				search:"",
				data:[],
				curActionId:0,
				lastActionId:0
			}
		},
		methods: {
			reload(){
				this.showLoading()
				this.list.setData({_order:{id:"DESC"},_where:this.where,_search:this.search}).reload()
			},
			doSearch(){
				this.showLoading()
				this.list.setData({_order:{id:"DESC"},_where:this.where,_search:this.search}).reload()
			}
		},
		mounted() {
			this.list.initMescroll(this).setUrl('/api/user/machineBreaks').setData({
				_order:{id:"DESC"},
				_where:this.where,
				_search:this.search,
			}).setCbFunc(res=>{
				this.data = res
				this.clearLoading()
			}).reload()
		},
		onShow() {
			this.list.reload()
		},
	}
</script>

<style>

</style>
